<?
   require_once('config.php');
   $active = getValue('active','int','POST',0);
   $img_id = getValue('img_id','int','POST',0);
   $alb_id = getValue('alb_id','int','POST',0);
   //Uncheck old  avatar
   if($active == 1){
      $db_exe = new db_query('UPDATE 
                              xinh_images
                           SET
                              is_avatar = 0
                           WHERE
                              alb_id ='.$alb_id . ' AND is_avatar = 1');
   }
   
   $db_exe = new db_execute('UPDATE
                                 xinh_images
                              SET
                                 is_avatar='. $active.'
                              WHERE
                                 id =' . $img_id);
?>